this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(e,t,s,i,o,a,r,n,c){"use strict";let l=e=>e,h,d;class u{constructor(e){this.cache=new r.Cache.MemoryCache;this.setOptions(e)}setOptions(e){this.cache.set("options",{...e})}getOptions(){return this.cache.get("options",{})}setValue(e){if(r.Type.isString(e)||r.Type.isNumber(e)){this.getValueLayout().textContent=e}}getValueLayout(){return this.cache.remember("valueLayout",(()=>r.Tag.render(h||(h=l`
				<div class="ui-stamp-uploader-header-text-value">
					<span title="${0}">${0}</span>
				</div>
			`),r.Text.encode(this.getOptions().contact.label),r.Text.encode(this.getOptions().contact.label))))}getChangeContactButton(){return this.cache.remember("changeContactButton",(()=>new c.Button({text:r.Loc.getMessage("UI_STAMP_UPLOADER_HEADER_CHANGE_CONTACT_BUTTON_LABEL"),size:c.Button.Size.EXTRA_SMALL,color:c.Button.Color.LIGHT_BORDER,round:true})))}getLayout(){return this.cache.remember("headerLayout",(()=>r.Tag.render(d||(d=l`
				<div class="ui-stamp-uploader-header">
					<div class="ui-stamp-uploader-header-icon">
						<div class="ui-stamp-uploader-header-icon-image"></div>
					</div>
					<div class="ui-stamp-uploader-header-text">
						<div class="ui-stamp-uploader-header-text-label">
							${0}
						</div>
						${0}
					</div>
					<div class="ui-stamp-uploader-header-action">
						
					</div>
				</div>
			`),r.Loc.getMessage("UI_STAMP_UPLOADER_HEADER_TITLE"),this.getValueLayout())))}appendTo(e){if(r.Type.isDomNode(e)){r.Dom.append(this.getLayout(),e)}}prependTo(e){if(r.Type.isDomNode(e)){r.Dom.prepend(this.getLayout(),e)}}renderTo(e){this.appendTo(e)}}let p=e=>e,g;class m{constructor(e){this.cache=new r.Cache.MemoryCache;this.setOptions(e)}setOptions(e){this.cache.set("options",{...e})}getOptions(){return this.cache.get("options",{})}getLayout(){return this.cache.remember("layout",(()=>r.Tag.render(g||(g=p`
				<div class="ui-stamp-uploader-upload-layout">
					${0}
				</div>
			`),this.getOptions().children.map((e=>e.getLayout())))))}}let v=e=>e,C;class L extends n.EventEmitter{constructor(e={}){super();this.cache=new r.Cache.MemoryCache;this.setEventNamespace("BX.UI.Stamp.Uploader.Dropzone");this.subscribeFromOptions(e.events);this.setOptions(e)}setOptions(e){this.cache.set("options",{...e})}getOptions(){return this.cache.get("options",{})}getLayout(){return this.cache.remember("layout",(()=>r.Tag.render(C||(C=v`
				<div class="ui-stamp-uploader-dropzone">
					<div class="ui-stamp-uploader-dropzone-icon"></div>
					<div class="ui-stamp-uploader-dropzone-header">
						${0}
					</div>
					<div class="ui-stamp-uploader-dropzone-text">
						${0}
					</div>
				</div>
			`),r.Loc.getMessage("UI_STAMP_UPLOADER_DROPZONE_HEADER"),r.Loc.getMessage("UI_STAMP_UPLOADER_DROPZONE_TEXT"))))}}let b=e=>e,P,S,w;class A extends n.EventEmitter{constructor(e){super();this.cache=new r.Cache.MemoryCache;this.setEventNamespace("BX.UI.Stamp.Uploader.ActionPanel");this.subscribeFromOptions(e.events);this.setOptions(e)}setOptions(e){this.cache.set("options",{...e})}getOptions(){return this.cache.get("options",{})}getCropButton(){return this.cache.remember("cropButton",(()=>{const e=e=>{e.preventDefault();this.emit("onCropClick")};return r.Tag.render(P||(P=b`
				<div 
					class="ui-stamp-uploader-crop-button"
					onclick="${0}"
				>
					${0}
				</div>
			`),e,r.Loc.getMessage("UI_STAMP_UPLOADER_CROP_BUTTON_LABEL"))}))}getApplyButton(){return this.cache.remember("applyButton",(()=>new c.ApplyButton({color:c.Button.Color.PRIMARY,size:c.Button.Size.EXTRA_SMALL,round:true,onclick:()=>{this.emit("onApplyClick")}})))}getCancelButton(){return this.cache.remember("cancelButton",(()=>new c.CancelButton({color:c.Button.Color.LIGHT_BORDER,size:c.Button.Size.EXTRA_SMALL,round:true,onclick:()=>{this.emit("onCancelClick")}})))}getCropActionsLayout(){return this.cache.remember("cropActionsLayout",(()=>r.Tag.render(S||(S=b`
				<div class="ui-stamp-uploader-action-crop-actions" hidden>
					${0}
					${0}
				</div>
			`),this.getApplyButton().render(),this.getCancelButton().render())))}showCropAction(){r.Dom.show(this.getCropActionsLayout());r.Dom.hide(this.getCropButton())}hideCropActions(){r.Dom.hide(this.getCropActionsLayout());r.Dom.show(this.getCropButton())}getLayout(){return this.cache.remember("layout",(()=>r.Tag.render(w||(w=b`
				<div class="ui-stamp-uploader-action-panel">
					${0}
					${0}
				</div>
			`),this.getCropActionsLayout(),this.getCropButton())))}disable(){r.Dom.addClass(this.getLayout(),"ui-stamp-uploader-action-panel-disabled")}enable(){r.Dom.removeClass(this.getLayout(),"ui-stamp-uploader-action-panel-disabled")}}let D=e=>e,E,_,T,y;class I{constructor(){this.cache=new r.Cache.MemoryCache}static formatSize(e){if(e===0){return`0 ${r.Loc.getMessage("UI_STAMP_UPLOADER_UPLOAD_STATUS_SIZE_B")}`}const t=[r.Loc.getMessage("UI_STAMP_UPLOADER_UPLOAD_STATUS_SIZE_B"),r.Loc.getMessage("UI_STAMP_UPLOADER_UPLOAD_STATUS_SIZE_KB"),r.Loc.getMessage("UI_STAMP_UPLOADER_UPLOAD_STATUS_SIZE_MB")];const s=Math.floor(Math.log(e)/Math.log(1024));return{number:parseFloat((e/Math.pow(1024,s)).toFixed(2)),text:t[s]}}getUploadStatusLayout(){return this.cache.remember("statusLayout",(()=>{const e=r.Tag.render(E||(E=D`
				<div class="ui-stamp-uploader-upload-status-loader"></div>
			`));const t=new o.Loader({target:e,mode:"inline",size:45});void t.show();return r.Tag.render(_||(_=D`
				<div class="ui-stamp-uploader-upload-status">
					${0}
					<div class="ui-stamp-uploader-upload-status-text">
						${0}
					</div>
					<div class="ui-stamp-uploader-upload-status-percent">
						${0}
					</div>
					<div class="ui-stamp-uploader-upload-status-size">
						${0}
					</div>
				</div>
			`),e,r.Loc.getMessage("UI_STAMP_UPLOADER_UPLOAD_STATUS_TEXT"),r.Loc.getMessage("UI_STAMP_UPLOADER_UPLOAD_STATUS_PERCENT"),r.Loc.getMessage("UI_STAMP_UPLOADER_UPLOAD_STATUS_SIZE"))}))}updateUploadStatus(e={percent:0,size:0}){const t=this.cache.remember("percentNode",(()=>this.getUploadStatusLayout().querySelector(".ui-stamp-uploader-upload-status-percent")));const s=this.cache.remember("sizeNode",(()=>this.getUploadStatusLayout().querySelector(".ui-stamp-uploader-upload-status-size")));t.innerHTML=r.Loc.getMessage("UI_STAMP_UPLOADER_UPLOAD_STATUS_PERCENT").replace("{{number}}",`<strong>${r.Text.encode(e.percent)}</strong>`);const i=I.formatSize(e.size);s.textContent=r.Loc.getMessage("UI_STAMP_UPLOADER_UPLOAD_STATUS_SIZE").replace("{{number}}",i.number).replace("{{text}}",i.text)}getPreparingStatusLayout(){return this.cache.remember("preparingStatusLayout",(()=>r.Tag.render(T||(T=D`
				<div class="ui-stamp-uploader-preparing-status">
					<div class="ui-stamp-uploader-preparing-status-icon"></div>
					<div class="ui-stamp-uploader-preparing-status-text">
						${0}		
					</div>
				</div>
			`),r.Loc.getMessage("UI_STAMP_UPLOADER_PREPARING_STATUS"))))}getLayout(){return this.cache.remember("layout",(()=>r.Tag.render(y||(y=D`
				<div class="ui-stamp-uploader-status"></div>
			`))))}showUploadStatus(e={reset:false}){const t=this.getLayout();const s=this.getUploadStatusLayout();const i=this.getPreparingStatusLayout();r.Dom.remove(i);r.Dom.append(s,t);if(e.reset===true){this.updateUploadStatus({percent:0,size:0})}this.setOpacity(1);this.show()}showPreparingStatus(){const e=this.getLayout();const t=this.getUploadStatusLayout();const s=this.getPreparingStatusLayout();r.Dom.remove(t);r.Dom.append(s,e);this.setOpacity(.45);this.show()}setOpacity(e){r.Dom.style(this.getLayout(),"background-color",`rgba(255, 255, 255, ${e})`)}hide(){r.Dom.removeClass(this.getLayout(),"ui-stamp-uploader-status-show")}show(){r.Dom.addClass(this.getLayout(),"ui-stamp-uploader-status-show")}}let O=e=>e,U,B,M,R;var f=babelHelpers.classPrivateFieldLooseKey("loadImage");var x=babelHelpers.classPrivateFieldLooseKey("setIsCropEnabled");class N extends n.EventEmitter{constructor(e={}){super();Object.defineProperty(this,x,{value:H});this.cache=new r.Cache.MemoryCache;this.setEventNamespace("BX.UI.Stamp.Uploader");this.subscribeFromOptions(e.events);this.setOptions(e);const t=this.cache.remember("draggable",(()=>new a.Draggable({container:this.getLayout(),draggable:".ui-stamp-uploader-preview-crop > div",type:a.Draggable.HEADLESS,context:window.top})));t.subscribe("start",this.onDragStart.bind(this));t.subscribe("move",this.onDragMove.bind(this));t.subscribe("end",this.onDragEnd.bind(this))}setOptions(e){this.cache.set("options",{...e})}getOptions(){return this.cache.get("options",{})}getDraggable(){return this.cache.get("draggable")}getDevicePixelRatio(){return window.devicePixelRatio}getCanvas(){const e=this.cache.remember("canvas",(()=>r.Tag.render(U||(U=O`
				<canvas class="ui-stamp-uploader-preview-canvas"></canvas>
			`))));const t=setTimeout((()=>{if(r.Type.isDomNode(e.parentElement)&&!this.cache.has("adjustCanvas")){const t={width:e.parentElement.clientWidth,height:e.parentElement.clientHeight};if(t.width>0&&t.height>0){void this.cache.remember("adjustCanvas",(()=>{const s=this.getDevicePixelRatio();e.width=t.width*s;e.height=t.height*s;r.Dom.style(e,{width:`${t.width}px`,height:`${t.height}px`});const i=e.getContext("2d");const{context2d:o={}}=this.getOptions();if(r.Type.isPlainObject(o)){Object.assign(i,o)}i.scale(s,s)}))}}clearTimeout(t)}));return e}getImagePreviewLayout(){return this.cache.remember("imagePreviewLayout",(()=>r.Tag.render(B||(B=O`
				<div class="ui-stamp-uploader-preview-image">
					${0}
				</div>
			`),this.getCanvas())))}getLayout(){return this.cache.remember("layout",(()=>r.Tag.render(M||(M=O`
				<div 
					class="ui-stamp-uploader-preview" 
					title="${0}"
				>
					${0}
					${0}
				</div>
			`),r.Loc.getMessage("UI_STAMP_UPLOADER_PREVIEW_TITLE"),this.getImagePreviewLayout(),this.getCropControl())))}clear(){const e=this.getCanvas();const t=e.getContext("2d");t.clearRect(0,0,e.width,e.height)}setSourceImage(e){this.cache.set("sourceImage",e)}getSourceImage(){return this.cache.get("sourceImage",null)}setSourceImageRect(e){this.cache.set("sourceImageRect",e)}getSourceImageRect(){return this.cache.get("sourceImageRect",{})}setCurrentDrawOptions(e){this.cache.set("currentDrawOptions",e)}getCurrentDrawOptions(){return this.cache.get("currentDrawOptions",{})}applyCrop(){const e=this.getCropRect();const t=this.getCurrentDrawOptions();const s=this.getSourceImageRect();const i=s.width/t.dWidth;const o=this.getCanvas();const a={sX:(e.left-t.dX)*i,sY:(e.top-t.dY)*i,sWidth:e.width*i,sHeight:e.height*i,dWidth:e.width,dHeight:e.height,dX:(o.clientWidth-e.width)/2,dY:(o.clientHeight-e.height)/2};return this.renderImage(this.getSourceImage(),a)}renderImage(e,t={}){const s=this.getCanvas();const i=s.getContext("2d");return babelHelpers.classPrivateFieldLooseBase(N,f)[f](e).then((e=>{const o={width:e.width,height:e.height};const a=Math.min(s.clientWidth/o.width,s.clientHeight/o.height);const r={sX:0,sY:0,sWidth:o.width,sHeight:o.height,dX:(s.clientWidth-o.width*a)/2,dY:(s.clientHeight-o.height*a)/2,dWidth:o.width*a,dHeight:o.height*a,...t};this.setSourceImageRect(o);this.setCurrentDrawOptions(r);this.clear();i.drawImage(e,r.sX,r.sY,r.sWidth,r.sHeight,r.dX,r.dY,r.dWidth,r.dHeight)}))}setInitialCropRect(e){this.cache.set("initialCropRect",e)}getInitialCropRect(){return this.cache.get("initialCropRect")}getCropControl(){return this.cache.remember("cropControl",(()=>r.Tag.render(R||(R=O`
				<div class="ui-stamp-uploader-preview-crop">
					<div class="ui-stamp-uploader-preview-crop-top"></div>
					<div class="ui-stamp-uploader-preview-crop-right"></div>
					<div class="ui-stamp-uploader-preview-crop-bottom"></div>
					<div class="ui-stamp-uploader-preview-crop-left"></div>
					<div class="ui-stamp-uploader-preview-crop-rotate"></div>
				</div>
			`))))}isCropEnabled(){return this.cache.get("isCropEnabled",false)}enableCrop(){this.renderImage(this.getSourceImage()).then((()=>{const e=this.getCropControl();const t=this.getCurrentDrawOptions();r.Dom.style(e,{top:`${t.dY}px`,bottom:`${t.dY}px`,left:`${t.dX}px`,right:`${t.dX}px`});r.Dom.addClass(e,"ui-stamp-uploader-preview-crop-show");babelHelpers.classPrivateFieldLooseBase(this,x)[x](true)}))}disableCrop(){r.Dom.removeClass(this.getCropControl(),"ui-stamp-uploader-preview-crop-show");babelHelpers.classPrivateFieldLooseBase(this,x)[x](false)}onDragStart(){const e=this.getCropControl();this.setInitialCropRect({top:r.Text.toNumber(r.Dom.style(e,"top")),left:r.Text.toNumber(r.Dom.style(e,"left")),right:r.Text.toNumber(r.Dom.style(e,"right")),bottom:r.Text.toNumber(r.Dom.style(e,"bottom"))})}onDragMove(e){const t=e.getData();const s=this.getInitialCropRect();const i=this.getCurrentDrawOptions();const o=20;const a=i.dX+i.dWidth+i.dX;const n=i.dY+i.dHeight+i.dY;if(t.source.matches(".ui-stamp-uploader-preview-crop-right")){const e=Math.max(Math.min(s.right-t.offsetX,a-s.left-o),i.dX);r.Dom.style(this.getCropControl(),"right",`${e}px`)}if(t.source.matches(".ui-stamp-uploader-preview-crop-left")){const e=Math.max(Math.min(s.left+t.offsetX,a-s.right-o),i.dX);r.Dom.style(this.getCropControl(),"left",`${e}px`)}if(t.source.matches(".ui-stamp-uploader-preview-crop-top")){const e=Math.max(i.dY,Math.min(s.top+t.offsetY,n-s.bottom-o));r.Dom.style(this.getCropControl(),"top",`${e}px`)}if(t.source.matches(".ui-stamp-uploader-preview-crop-bottom")){const e=Math.max(Math.min(n-s.top-o,s.bottom-t.offsetY),i.dY);r.Dom.style(this.getCropControl(),"bottom",`${e}px`)}}getCropRect(){const e=this.getCropControl();const t=e.clientWidth;const s=e.clientHeight;const i=Math.round(r.Text.toNumber(r.Dom.style(e,"left")));const o=Math.round(r.Text.toNumber(r.Dom.style(e,"top")));const a=this.getCanvas();const n=a.getBoundingClientRect();const c=n.width-(i+t);const l=n.height-(o+s);return{width:t,height:s,top:o,left:i,right:c,bottom:l}}async getValue(){const e=this.getCanvas();return await new Promise((t=>{e.toBlob(t,"image/png")}))}onDragEnd(e){}show(e){this.setSourceImage(e);void this.renderImage(e);r.Dom.addClass(this.getLayout(),"ui-stamp-uploader-preview-show")}hide(){r.Dom.removeClass(this.getLayout(),"ui-stamp-uploader-preview-show")}getFile(){const e=this.getCurrentDrawOptions();const t=document.createElement("canvas");const s=t.getContext("2d");return new Promise((i=>{this.getCanvas().toBlob((o=>{void babelHelpers.classPrivateFieldLooseBase(N,f)[f](o).then((o=>{const a=this.getDevicePixelRatio();t.width=e.dWidth*a;t.height=e.dHeight*a;s.drawImage(o,0,0,o.width,o.height,-((o.width-t.width)/2),-((o.height-t.height)/2),o.width,o.height);t.toBlob((e=>{i(e)}))}))}))}))}}function F(e){const t=new FileReader;return new Promise((s=>{t.readAsDataURL(e);r.Event.bindOnce(t,"loadend",(()=>{const e=new Image;e.src=t.result;r.Event.bindOnce(e,"load",(()=>{s(e)}))}))}))}function H(e){this.cache.set("isCropEnabled",e)}Object.defineProperty(N,f,{value:F});let $=e=>e,X;class k{constructor(){this.cache=new r.Cache.MemoryCache}getLayout(){return this.cache.remember("layout",(()=>r.Tag.render(X||(X=$`
				<div class="ui-stamp-uploader-message">
					<div class="ui-stamp-uploader-message-icon"></div>
					<div class="ui-stamp-uploader-message-text">
						<div class="ui-stamp-uploader-message-text-header">
							${0}
						</div>
						<div class="ui-stamp-uploader-message-text-description">
							${0}
						</div>
					</div>
				</div>
			`),r.Loc.getMessage("UI_STAMP_UPLOADER_SLIDER_MESSAGE_TITLE"),r.Loc.getMessage("UI_STAMP_UPLOADER_SLIDER_MESSAGE_DESCRIPTION"))))}}let z=e=>e,W;class Y extends n.EventEmitter{constructor(e={}){super();this.cache=new r.Cache.MemoryCache;this.setEventNamespace("BX.UI.Stamp.Uploader.FileSelect");this.subscribeFromOptions(e.events);this.setOptions(e)}setOptions(e){this.cache.set("options",{...e})}getOptions(){return this.cache.get("options",{})}getTakePhotoButton(){return this.cache.remember("takePhotoButton",(()=>new c.Button({text:r.Loc.getMessage("UI_STAMP_UPLOADER_TAKE_PHOTO_BUTTON_LABEL"),color:c.Button.Color.LIGHT_BORDER,size:c.Button.Size.LARGE,icon:c.Button.Icon.CAMERA,round:true,onclick:()=>{this.emit("onTakePhotoClick")}})))}getSelectPhotoButton(){return this.cache.remember("selectPhotoButton",(()=>new c.Button({text:r.Loc.getMessage("UI_STAMP_UPLOADER_SELECT_PHOTO_BUTTON_LABEL"),color:c.Button.Color.LIGHT_BORDER,size:c.Button.Size.LARGE,icon:c.Button.Icon.DOWNLOAD,round:true,onclick:()=>{this.emit("onTakePhotoClick")}})))}getLayout(){return this.cache.remember("layout",(()=>r.Tag.render(W||(W=z`
				<div class="ui-stamp-uploader-file-select">
					<div class="ui-stamp-uploader-file-select-select-photo">
						${0}
					</div>
				</div>
			`),this.getSelectPhotoButton().render())))}}let G=e=>e,j,K,Z;var V=babelHelpers.classPrivateFieldLooseKey("delay");var q=babelHelpers.classPrivateFieldLooseKey("setPreventConfirmShow");var J=babelHelpers.classPrivateFieldLooseKey("isConfirmShowPrevented");class Q extends n.EventEmitter{constructor(e){super();Object.defineProperty(this,J,{value:se});Object.defineProperty(this,q,{value:te});this.cache=new r.Cache.MemoryCache;this.setEventNamespace("BX.UI.Stamp.Uploader");this.subscribeFromOptions(e.events);this.setOptions(e);this.cache.remember("fileUploader",(()=>{const e=this.getDropzone().getLayout();const s=this.getPreview().getLayout();const i=this.getFileSelect().getLayout();r.Event.bind(s,"click",(e=>{if(this.getPreview().isCropEnabled()){e.stopImmediatePropagation()}}));return new t.Uploader({controller:this.getOptions().controller.upload,assignAsFile:true,browseElement:[e,s,i,this.getHiddenInput()],dropElement:[e,s],imagePreviewHeight:556,imagePreviewWidth:1e3,autoUpload:false,acceptedFileTypes:["image/png","image/jpeg"],events:{[t.UploaderEvent.FILE_ADD]:e=>{const{file:t,error:s}=e.getData();if(r.Type.isNil(s)){this.getPreview().show(t.getClientPreview());this.setUploaderFile(t);if(this.getMode()===Q.Mode.SLIDER){this.getSliderButtons().saveButton.setDisabled(false);this.getActionPanel().enable()}if(this.getMode()===Q.Mode.INLINE){this.getInlineSaveButton().setDisabled(false);this.getActionPanel().enable()}this.setIsChanged(true)}},[t.UploaderEvent.FILE_UPLOAD_PROGRESS]:e=>{const{progress:t,file:s}=e.getData();this.getStatus().updateUploadStatus({percent:t,size:s.getSize()/100*t})},[t.UploaderEvent.FILE_ERROR]:function(e){const{error:t}=e.getData();Q.showAlert(t.getMessage())}}})}))}static showAlert(...e){const t=r.Reflection.getClass("top.BX.UI.Dialogs.MessageBox");if(!r.Type.isNil(t)){t.alert(...e)}}static showConfirm(e){const t=r.Reflection.getClass("top.BX.UI.Dialogs.MessageBox");const s=r.Reflection.getClass("top.BX.UI.Dialogs.MessageBoxButtons");if(!r.Type.isNil(t)){t.show({modal:true,buttons:s.OK_CANCEL,...e})}}setIsChanged(e){this.cache.set("isChanged",e)}isChanged(){return this.cache.get("isChanged",false)}getFileUploader(){return this.cache.get("fileUploader")}setUploaderFile(e){this.cache.set("uploaderFile",e)}getUploaderFile(){return this.cache.get("uploaderFile",null)}setOptions(e){this.cache.set("options",{...e})}getOptions(){return this.cache.get("options",{})}getMode(){const{mode:e}=this.getOptions();if(Object.values(Q.Mode).includes(e)){return e}return Q.Mode.SLIDER}getHeader(){return this.cache.remember("header",(()=>new u(this.getOptions())))}getPreview(){return this.cache.remember("preview",(()=>new N({})))}getFileSelect(){return this.cache.remember("fileSelect",(()=>new Y({events:{onTakePhotoClick:()=>{this.emit("onTakePhotoClick")},onSelectPhotoClick:()=>{}}})))}getUploadLayout(){return this.cache.remember("uploadLayout",(()=>new m({children:[(()=>{if(this.getMode()===Q.Mode.INLINE){return this.getFileSelect()}return this.getDropzone()})(),this.getActionPanel(),this.getStatus(),this.getPreview()]})))}getDropzone(){return this.cache.remember("dropzone",(()=>new L({})))}getActionPanel(){return this.cache.remember("actionPanel",(()=>new A({events:{onCropClick:this.onCropClick.bind(this),onApplyClick:this.onCropApplyClick.bind(this),onCancelClick:this.onCropCancelClick.bind(this)}})))}onCropApplyClick(){this.getPreview().applyCrop();this.getPreview().disableCrop();this.getActionPanel().hideCropActions();this.getInlineSaveButton().setDisabled(false);this.getActionPanel().enable()}onCropCancelClick(){this.getPreview().disableCrop();this.getActionPanel().hideCropActions();this.getInlineSaveButton().setDisabled(false);this.getActionPanel().enable()}onCropClick(){this.getPreview().enableCrop();this.getActionPanel().showCropAction();this.getInlineSaveButton().setDisabled(true);this.getActionPanel().enable()}getStatus(){return this.cache.remember("status",(()=>new I))}getLayout(){return this.cache.remember("layout",(()=>{const e=this.getMode();return r.Tag.render(j||(j=G`
				<div class="ui-stamp-uploader ui-stamp-uploader-mode-${0}">
					${0}
					${0}
					${0}
					${0}
					${0}
				</div>
			`),e,(()=>{if(e===Q.Mode.SLIDER){return this.getMessage().getLayout()}return""})(),this.getHeader().getLayout(),this.getUploadLayout().getLayout(),(()=>{if(e===Q.Mode.INLINE){return r.Tag.render(K||(K=G`
								<div class="ui-stamp-uploader-footer">
									${0}
								</div>
							`),this.getInlineSaveButton().render())}return""})(),this.getHiddenInput())}))}getHiddenInput(){return this.cache.remember("hiddenInput",(()=>r.Tag.render(Z||(Z=G`
				<input type="file" name="STAMP_UPLOADER_INPUT" hidden>
			`))))}renderTo(e){if(r.Type.isDomNode(e)){r.Dom.append(this.getLayout(),e)}}upload(){return new Promise((e=>{this.getPreview().getFile().then((s=>{this.getFileUploader().addFile(s);const[i]=this.getFileUploader().getFiles();i.subscribeOnce(t.FileEvent.LOAD_COMPLETE,(()=>{this.getPreview().hide();this.getStatus().showUploadStatus({reset:true});i.upload({onComplete:()=>{e(i)},onError:console.error})}))}))}))}getMessage(){return this.cache.remember("message",(()=>new k))}getInlineSaveButton(){return this.cache.remember("inlineSaveButton",(()=>{const e=new c.Button({text:r.Loc.getMessage("UI_STAMP_UPLOADER_SAVE_BUTTON_LABEL"),color:c.Button.Color.PRIMARY,size:c.Button.Size.LARGE,round:true,onclick:()=>{const e=this.getInlineSaveButton();e.setWaiting(true);this.upload().then((e=>Promise.all([new Promise((t=>{babelHelpers.classPrivateFieldLooseBase(Q,V)[V]((()=>{this.getPreview().show(e.getClientPreview());this.getStatus().showPreparingStatus();t()}),1e3)})),this.emitAsync("onSaveAsync",{file:e.toJSON()})]))).then((()=>{this.getStatus().hide();babelHelpers.classPrivateFieldLooseBase(Q,V)[V]((()=>{e.setWaiting(false);e.setDisabled(true);this.getActionPanel().disable()}),500)}))}});e.setDisabled(true);this.getActionPanel().disable();return e}))}setSliderButtons(e){this.cache.set("sliderButtons",e)}getSliderButtons(){return this.cache.get("sliderButtons",{saveButton:null,cancelButton:null})}show(){const e=r.Reflection.getClass("BX.SidePanel.Instance");if(r.Type.isNil(e)){return}this.getPreview().hide();this.getStatus().hide();this.getActionPanel().disable();e.open("stampUploader",{width:640,contentCallback:()=>i.Layout.createContent({extensions:["ui.stamp.uploader"],content:()=>this.getLayout(),design:{section:false},buttons:({cancelButton:e,SaveButton:t})=>{const s=new t({onclick:()=>{s.setWaiting(true);this.setIsChanged(false);babelHelpers.classPrivateFieldLooseBase(this,q)[q](true);this.upload().then((e=>{babelHelpers.classPrivateFieldLooseBase(Q,V)[V]((()=>{this.getPreview().show(e.getClientPreview());this.getStatus().showPreparingStatus()}),1e3);return this.emitAsync("onSaveAsync",{file:e.toJSON()})})).then((()=>{this.getStatus().hide();babelHelpers.classPrivateFieldLooseBase(Q,V)[V]((()=>{s.setWaiting(false);s.setDisabled(true);this.getActionPanel().disable();BX.SidePanel.Instance.close()}),500)}))}});s.setDisabled(true);this.getActionPanel().disable();this.setSliderButtons({saveButton:s,cancelButton:e});return[s,e]}}),events:{onClose:e=>{if(this.isChanged()){e.denyAction();if(!babelHelpers.classPrivateFieldLooseBase(this,J)[J]()){Q.showConfirm({message:r.Loc.getMessage("UI_STAMP_UPLOADER_SLIDER_CLOSE_CONFIRM"),onOk:t=>{this.setIsChanged(false);e.getSlider().close();t.close()},okCaption:r.Loc.getMessage("UI_STAMP_UPLOADER_SLIDER_CLOSE_CONFIRM_CLOSE"),onCancel:e=>{e.close()},cancelCaption:r.Loc.getMessage("UI_STAMP_UPLOADER_SLIDER_CLOSE_CONFIRM_CANCEL")})}else{this.setIsChanged(false);e.getSlider().close()}}}}})}}function ee(e,t){const s=setTimeout((()=>{e();clearTimeout(s)}),t)}function te(e){this.cache.set("preventConfirmShow",e)}function se(){return this.cache.get("preventConfirmShow",false)}Object.defineProperty(Q,V,{value:ee});Q.Mode={SLIDER:"slider",INLINE:"inline"};e.Uploader=Q})(this.BX.UI.Stamp=this.BX.UI.Stamp||{},BX.UI.Uploader,BX.UI.Dialogs,BX.UI.SidePanel,BX,BX.UI.DragAndDrop,BX,BX.Event,BX.UI);
//# sourceMappingURL=uploader.bundle.map.js